<!DOCTYPE html>
<meta charset="utf-8" />
<link rel="stylesheet" href="ace_v1.3/assets/css/ui.jqgrid.css" />

<div class="search_panel">
<form action="mpomng/prdInf/queryPrdInfList.do" method="post" onsubmit="return pageSearch(this); ">
	<div style="display: block;" class="widget-body ">
		<div class="widget-main">
			<div class="rowt">
				<div class="col-sm-12">
					<div>
					<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">商品订单号:</label>
							<div class="search_input">
								<input id="prdordno" type="text" name="prdordno" placeholder="请输入商品订单号">
							</div>
						</div>
						
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">商品名称:</label>
							<div class="search_input">
								<input id="goodsName" type="text" name="goodsName" placeholder="请输入发送内容">
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">商品简称:</label>
							<div class="search_input">
								<input id="goodsNameShort" type="text" name="goodsNameShort" placeholder="请输入发送内容">
							</div>
						</div>
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">支付订单号:</label>
							<div class="search_input">
								<input type="text" id="payordno" name="payordno" placeholder="请输入支付订单号" 
				class="col-xs-10 col-sm-7" />
							</div>
						</div>
						
						<div class="search_elm" style="margin-left: 0px;margin-right: 15px;width: 280px;">
						    <label class="label_search" for="userName">订单日期:</label>
							<div class="input-daterange input-group">
								<input type="text" class="input-sm form-control" name="sdate" placeholder="起始日期" />
								<span class="input-group-addon">
									<i class="fa fa-exchange"></i>
								</span>
								<input type="text" class="input-sm form-control" name="edate" placeholder="结束日期" />
							</div>

							<!-- /section:plugins/date-time.datepicker -->
						</div>
						
						
						
						<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">订单状态:</label>
							<div class="search_input">
							 <select 
		                rel="obj.ORDSTATUS"
						location="local" 
		                name="ordstatus" 
		                id="search_ordstatus" 
		                data-placeholder="请选择订单状态  " 
		                style="width: 120px;vertical-align:middle;">
						<option value="">---请选择---</option>
						 </select>
							</div>
						</div>
						
					<div class="search_elm" style="margin-left: 0px">
							<label class="label_search">订单类型:</label>
							<div class="search_input">
							<select 
		rel="obj.PRDORDTYPE"
						location="local" 
		 name="prdordtype" 
		 id="search_prdordtype" 
		 data-placeholder="请选择订单类型  " 
		  style="width: 120px;vertical-align:middle;">
		  <option  value="">---请选择---</option>
						 </select>
							</div>
						</div>	
						<div class="search_elm">
							<button class="btn btn-small btn_search" type="submit" title="搜索" onclick="searchTotal()">
								搜索
							</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div style="display: block;" class="widget-body " id="total">
		
	</div>
	</form>
</div>


	<div class="row">
		<div class="col-xs-12">
			<table id="grid-table"></table>
			<div id="grid-pager"></div>
			
			<div style="margin-top: 10px">
			 <span id="paging_bar" style="float: right"> </span>
			</div>
			<!-- PAGE CONTENT ENDS -->
		</div>
		<!-- /.col -->
	</div>
	<!-- /.row -->

	<!-- page specific plugin scripts -->
	<script type="text/javascript">
	var jqGrid;
	jQuery(function($) {
		var grid_selector = "#grid-table";
		var pager_selector = "#grid-pager";

		$(window).on(
				'resize.jqGrid',
				function() {
					$(grid_selector).jqGrid('setGridWidth',$(".page-content").width());
				})
		var parent_column = $(grid_selector).closest('[class*="col-"]');
		$(document).on(
				'settings.ace.jqGrid',
				function(ev, event_name, collapsed) {
					if (event_name === 'sidebar_collapsed'|| event_name === 'main_container_fixed') {
						setTimeout(function() {
							$(grid_selector).jqGrid('setGridWidth',parent_column.width());
						}, 0);
					}
				})
		jQuery(grid_selector).jqGrid({
			url : "mpomng/prdInf/queryPrdInfList.do",
			datatype : "json",
			height : '100%',
			width : '100%',
			colNames : [ '商品订单号','商户编号','订单类型  ','子业务类型','订单状态','订单金额','支付订单号','商品单价','商品名称','商品简称','订单日期','最后更新时间','操作' ],
			colModel : [   {name : 'prdordno',        index : 'prdordno',        width : '150px',sortable:false }, 
			               {name : 'custId',        index : 'custId',        width : '150px',sortable:false } ,
			               {name : 'prdordtype',        index : 'prdordtype',        width : '100px',sortable:false,ditcKey:'PRDORDTYPE' ,formatter : gridFormatByDict }, 
						     {name : 'biztype',        index : 'biztype',        width : '100px',sortable:false,ditcKey:'BIZTYPE' ,formatter : gridFormatByDict }, 
						     {name : 'ordstatus',        index : 'ordstatus',        width : '100px',sortable:false,ditcKey:'ORDSTATUS' ,formatter : gridFormatByDict }, 
						     {name : 'ordamt',        index : 'ordamt',        width : '100px' ,sortable:false}, 
						     {name : 'payordno',        index : 'payordno',        width : '100px',sortable:false }, 
						     {name : 'price',        index : 'price',        width : '100px',sortable:false }, 
						     {name : 'goodsName',        index : 'goodsName',        width : '100px',sortable:false } ,
						     {name : 'goodsNameShort',        index : 'goodsNameShort',        width : '100px',sortable:false } ,
						     {name : 'prddate',        index : 'prddate',        width : '100px',sortable:false ,formatter : gridFormatByDate} ,
						     {name : 'modifyTime',        index : 'modifyTime',        width : '100px',hidden:true,sortable:false ,formatter : gridFormatByDate} ,
						     {name : '',        index : '',        width : '100px',formatter:operateEdit } 
			            ],
			viewrecords : true,
			rowNum : 10,
			rowList : [ 10, 20, 30 ],
			altRows : true,
			shrinkToFit : false,
			multiselect : true,//设置行可多选的 
			multiboxonly : true,//

			loadComplete : function() {
				var table = this;
				setTimeout(function() {
					//加载分页
					initPagingBar(grid_selector);
				}, 0);
			},
			beforeRequest : function() {//请求之前执行
				jqGrid = this;
			},
		});
		$(window).triggerHandler('resize.jqGrid');

		$(document).one('ajaxloadstart.page', function(e) {
			$(grid_selector).jqGrid('GridUnload');
			$('.ui-jqdialog').remove();
		});
		
		
		
		
		
			function operateEdit(cellvalue, options, rowObject){//定义button按钮
				var button = "<div class=\"hidden-sm hidden-xs btn-group\">";  
					button += "<button class='btn btn-xs btn-warning' onclick='selectPrdInf(\""+rowObject["prdordno"]+"\")'"   
					 +"title='详细信息查看'>详细</button>";
				return button;
			};
		 
	});
	
	 $(document).ready(function(){
		 searchTotal();
	
	 });
	
	function searchTotal(){
		 $.ajax({
				type : "post",
				url : "mpomng/prdInf/queryPrdInfCountList.do",
				data:$("form").serialize(),
				dataType : 'json',
				async:true,
				success : function(result) {
					if (result.rspcod != 200) {
						msg.alert("错误", result.rspmsg + " 错误代码："+ result.rspcod, 'error');
					} else {
						var ordamt="";
						count=result.obj[0].count;
						ordamt+=result.obj[0].ordamt;
						if(ordamt=="undefined"){
							ordamt="0";
						}
						var html="";
						html+="汇总笔数和金额:["+count+"]笔  |  [" +ordamt+ "]元  "
						$("#total").html(html);
						
					}
				},
				error : function(XMLHttpRequest, textStatus) {
					msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
				}
			});
	
	}
	
	
	function selectPrdInf(prdordno) {
		 if(prdordno.length<=0){
			msg.alert("警告", "当前没有选择数据项！", "error");
			return;
		}
		var scrWidth = document.body.scrollWidth;
		openDialog({
			dialogId : 'dlg-agentEdit',
			title : '收款订单信息详情',
			pageUrl :'mpomng/prdInf/prdInfDetailView.do',
			dataUrl : 'mpomng/prdInf/queryPrdDetail.do',
			width : '60%',
		    height:'70%',
			dataParam : {
				prdordno : prdordno
			},
			dataName : 'obj,map'//表单数据存储对象名称

		}); 
		
	}
	</script>